package com.xinxin.o2o.controller;

import com.xinxin.o2o.response.Response;
import com.xinxin.o2o.util.ResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


/**
 * @author hasee
 */
@Api(tags = "Swagger测试")
@RestController
@RequestMapping("/api/test")
public class TestController {
    @ApiOperation("测试方法")
    @GetMapping("index")
    public Response test() {
        return ResponseUtil.success();
    }

    @ApiOperation("多文件上传")
    @PostMapping("/files")
    public Response fileTest(@RequestParam MultipartFile[] files) {
        System.out.println(files.length);
        for (MultipartFile file : files) {
            System.out.println(file.getOriginalFilename());
        }
        return ResponseUtil.success();
    }
}
